#============================================================
#    Data Mana Test
#============================================================
# - datetime: 2022-11-23 19:58:42
#============================================================
@tool
extends EditorScript


var data_management = DataManagement.new()


func _run():
	# 连接信号当前对象的方法 (4.0 版本之后的新的连接方式)
	data_management.property_changed.connect(_property_changed)
	data_management.newly_added_property.connect(_newly_added_property)
	data_management.removed_property.connect(_removed_property)
	
	# 设置属性
	data_management.set_property("health", 2)
	# 添加属性值
	data_management.add_property("health", 1)
	# 移除属性
	data_management.remove_property("health")
	
	print("移除 health 属性后的值：", data_management.get_property("health") )


func _newly_added_property(property, value):
	print("新增属性：", property, ", value = ", value)


func _removed_property(property, value):
	print("移除属性：", property)


func _property_changed(property, previous, current):
	print(property, " 属性发生改变： previous = ", previous, ", current = ", current)
